<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="/jquerydemo/script/jquery-3.3.1.js"></script>
    <script>
        $().ready(function () {
            $.get("http://localhost:8080/ticket",
                function (resp, status, xhr) {
                    console.log(resp.data)
                    let html = "<thead><td>起始站</td><td>终点站</td></thead>";
                    for (var index = 0; index < resp.data.length; index++) {
                        html += "<tr><td>" + resp.data[index].startStation + "</td><td>" + resp.data[index].endStation + "</td></tr>"
                    }

                    $("#ticket_list").html(html);
                })

            $(":button").click(function () {
                $.post({url:"http://localhost:8080/ticket",
                    data:JSON.stringify({"startStation":"测试", "endStation":"测试"}),
                    contentType:"application/json",
                    success:function (resp, status, xhr) {
                        console.log(resp.data)
                        location.href = 'http://localhost:63343/jquerydemo/public/ticket.html'
                    }})
            })
        })
    </script>
</head>
<body>
<input type="button" value="add" />

<table id="ticket_list">
    <tr><td>起始站</td><td>终点站</td></tr>
</table>
</body>
</html>